home *** CD-ROM | disk | FTP | other *** search
-
- #include <string.h>
-
- char *ReplaceStr(char *StrSource,char *StrToFind,char *StrToReplace)
- {
- char *Temp = new char[strlen(StrSource)+1];
- strcpy(Temp,StrSource);
- strupr(Temp);
- char *Ptr, *OPtr;
- OPtr = Ptr = Temp;
- *StrSource = '\0';
- while ((Ptr = strstr(Ptr,StrToFind)) != NULL) {
- *Ptr = '\0';
- strcat(StrSource,OPtr);
- strcat(StrSource,StrToReplace);
- Ptr += strlen(StrToFind);
- OPtr = Ptr;
- }
- strcat(StrSource,OPtr);
- delete Temp;
- return(StrSource);
- }
-